package com.qqhru.pan.core.exception;

import com.qqhru.pan.core.response.ResponseCode;

/*自定义全局业务异常类*/
public class WPanBusinessException extends RuntimeException{

    /**
     * 错误码
     */
    private Integer code;

    /**
     * 错误信息
     */
    private String message;

    public WPanBusinessException(ResponseCode responseCode) {
        this.code = responseCode.getCode();
        this.message = responseCode.getDesc();
    }

    /*支持用户自己手动传状态码和信息*/
    public WPanBusinessException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public WPanBusinessException(String message) {
        this.code = ResponseCode.ERROR_PARAM.getCode();
        this.message = message;
    }

    public WPanBusinessException() {
        this.code = ResponseCode.ERROR_PARAM.getCode();
        this.message = ResponseCode.ERROR_PARAM.getDesc();
    }

}

